// component/tabbar/tabbar.js
var app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    selected:{
      type:Number,
      value:0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    color: "#7A7E83",
    selectedColor: "#ff002a",
    list: [{
      pagePath: "/pages/index/index",
      iconPath: "/static/tabbar/ic_menu_choice_nor.png",
      selectedIconPath: "/static/tabbar/ic_menu_choice_pressed.png",
      text: "首页"
    }, 
    {
      "pagePath": "/pages/auction/auction",
      "text": "拍卖",
      "iconPath": "/static/tabbar/ic_menu_topic_nor.png",
      "selectedIconPath": "/static/tabbar/ic_menu_topic_pressed.png"
    },
    {
      text: "发布",
    },
    {
      "pagePath": "/pages/message/message",
      "text": "消息",
      "iconPath": "/static/tabbar/ic_menu_shopping_nor.png",
      "selectedIconPath": "/static/tabbar/ic_menu_shopping_pressed.png"
    },
    {
      pagePath: "/pages/home/home",
      iconPath: "/static/tabbar/user1.png",
      selectedIconPath: "/static/tabbar/user2.png",
      text: "我的"
    }]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      if(url){
        wx.switchTab({url})
      }else{
        if(app.globalData.userInfo){
          wx.navigateTo({
            url: '/pages/release/release',
          })
        }else{
          wx.navigateTo({
            url: '/pages/local/local',
          })
        }
      }
      
    }

  }
})
